import request from '../utils/request.js'

// 重要API
export const generWorkFlow = function(data) {
	let t = Math.random()
	return request({
		url: `/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=GenerWorkNode&HttpHandlerName=BP.WF.HttpHandler.WF_MyFlow&t=${t}`,
		method: 'POST',
		data
	})
}

export function frmGenerInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=FrmGener_Init&HttpHandlerName=BP.WF.HttpHandler.WF_CCForm`,
		method: "POST",
		data: {
			...data,
		}
	});
}

export function getNodeMsg(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "Entity_Init",
			EnName: "BP.WF.Node",
			t: Math.random()
		}
	});
}

export function athInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Ath_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function athDownload(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AttachmentUpload_DownZip",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function athDelete(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AttachmentUpload_Del",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function getSFTable(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "Entity_DoMethodReturnString",
			EnName: "BP.Sys.SFTable",
			t: Math.random(),
			MethodName: "GenerDataOfJson"
		}
	});
}

export function getEnums(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "Entities_Init",
			EnsName: "BP.Sys.SysEnums",
			Paras: `@EnumKey=${data.EnumKey}`,
			t: Math.random()
		}
	});
}

export function dtlInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=Dtl_Init&HttpHandlerName=BP.WF.HttpHandler.WF_CCForm`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Dtl_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function deleteDtlRow(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Dtl_DeleteRow",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function saveDtlRow(data) {
	return request({
		url: `/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=Dtl_SaveRow&HttpHandlerName=BP.WF.HttpHandler.WF_CCForm`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Dtl_SaveRow",
			HttpHandlerName: "BP.WF.HttpHandler.WF_CCForm",
			t: Math.random()
		}
	});
}

export function sendFlow(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Send",
			HttpHandlerName: "BP.WF.HttpHandler.WF_MyFlow",
			t: Math.random()
		}
	});
}

export function unSendFlow(data) {
	return request({
		url: `/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=AccepterOfGener_UnSend&HttpHandlerName=BP.WF.HttpHandler.CCMobile_WorkOpt`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AccepterOfGener_UnSend",
			HttpHandlerName: "BP.WF.HttpHandler.CCMobile_WorkOpt",
			t: Math.random()
		}
	});
}

export function entityInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "Entity_Init",
			EnName: "BP.WF.Template.BtnLab",
			t: Math.random()
		}
	});
}

export function returnInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Return_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function returnFlow(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "DoReturnWork",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function forceAccepter(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Refmethod_Done",
			HttpHandlerName: "BP.WF.HttpHandler.WF_Comm",
			EnName: "BP.WF.Template.FlowExt",
			EnsName: "BP.WF.Template.FlowExts",
			Index: 31,
			t: Math.random()
		}
	});
}

export function accepterInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Accepter_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function accepterOfGenerInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AccepterOfGener_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function getAccepter(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AccepterOfGener_SelectEmps",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function accepterAddEmps(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AccepterOfGener_AddEmps",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function accepterOfGenerDel(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "AccepterOfGener_Delete",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function selectEmpsInit(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "SelectEmps_Init",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function accepterSend(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "HttpHandler",
			DoMethod: "Accepter_Send",
			HttpHandlerName: "BP.WF.HttpHandler.WF_WorkOpt",
			t: Math.random()
		}
	});
}

export function getSFTableKey(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "Entity_Init",
			EnName: "BP.Sys.SFTable",
			t: Math.random()
		}
	});
}

export function runUrlReturnString(data) {
	return request({
		url: `/WF/Comm/ProcessRequest`,
		method: "POST",
		data: {
			...data,
			DoType: "RunUrlCrossReturnString",
			t: Math.random()
		}
	});
}
